<?php
class page_base {

	private $titre;
	private $style=array('responsive', 'responsiveslides','style','zerogrid','jquery-ui','jquery-ui.theme');
	protected $js=array('jquery.min', 'jquery.dropotron.min','jquery-ui.min','jquery.ui.touch');
	private $corps;
	private $page;
	private $param; //type pour acceder a la page

	
	public function gparam()
	{if(isset($this->param))
	{return $this->param;}
	else
	{return null;
	}}
	
	public function __construct($p) {
		
		$this->page = $p;
	}

	/******** Gestion des setters  *******************/
	public function __set($propriete, $valeur) {
		switch ($propriete) {
			case 'style' : {
				$this->style[count($this->style)+1] = $valeur;
				break;
			}

			case 'corps' : {
				$this->corps = $valeur;
				break;
			}
			
			case 'titre' : {
				$this->titre = $valeur;
				break;
			}
			case 'js' : {
				$this->js[count($this->js)+1] = $valeur;
				break;
			}
		}
	}
	
	public function affiche_parametre() {
	if (isset($_GET['param'])){
		$this->param = $_GET['param'];}}

	
	/******** Gestion du titre  *******************/
	protected function affiche_titre() {
		echo utf8_encode($this->titre);
	}

	
	/******** Gestion du corps  *******************/
	protected function affiche_corps() {
		echo utf8_encode($this->corps);
	} 
	/*************Gestion des styles *********************/
	protected function affiche_style() {
		foreach ($this->style as $s) {
			echo "<link rel='stylesheet' href='styles/".$s.".css' />\n
					";
		}
	}
	protected function affiche_js() {
		foreach ($this->js as $s) {
			echo "<script src='js/".$s.".js'></script>\n
					";
		}
	}
	/************** Affichage du header de la page ***************************/
	protected function affiche_header() {
		?> <header>
	<div class="wrap-header zerogrid">
		<div id="logo"><a href="#"><img src="USEP.png"/></a></div>
		
			
		</div>
	</div>
</header>
		
				
			<?php
		}
		
		public function afficherTextbox()
		{ echo"<input type='text' name='licence'>";}
		
		/************** Affichage du nav de la page ***************************/
		private function affiche_nav() {
			?>
			
			<nav>
	<div class="wrap-nav zerogrid">
		<div class="menu">
		
			<ul>
				<li><a href="index.php">Accueil</a></li>
				<li><a href="Connexion.php">Connexion</a></li>
				<li><a href="contact.php">Contact</a></li>
				
			</ul>
		</div>
		
		
		<div class="minimenu"><div>MENU</div>
			<select onchange="location=this.value">
				<option></option>
				<option value="index.php">Accueil</option>
				<option value="Connexion.php">Connexion</option>
				<option value="contact.php">Contact</option>
			</select>
		</div>		
		
	</div>
</nav>
			
			
			
			
					<?php
				}
				
			
		
		
	/************** Affichage du pied de la page ***************************/
	protected function affiche_footer() {
		?>
		<footer>
	<div class="wrap-footer">
		<div class="copyright">
		<p>Copyright - USEP 2014 - Realisation CF / QE</p>
		</div>
	</div>
</footer>
			
			
		<?php
	}
	
	/******************** Fonction permettant l'affichage de la page **************/
	public function affiche() {
		?>
			<!DOCCTYPE html>
			<html lang='fr'>
				<head>
					<title>
						<?php $this->affiche_titre(); ?>
					</title>
					<meta charset="utf-8" /><link href='favicon.ico' rel='shortcut icon'/>
					<?php 
						$this->affiche_style(); 
						$this->affiche_js();
					?>
				</head>
				<header><?php 
						$this->affiche_header(); 
					?>
					
					</header>
					<nav><?php 
					
							$this->affiche_nav();

						
					?></nav>
				<body>
				
				<?php 
						$this->affiche_corps(); 
					?>
				
				
				
				</body>
				<footer><?php 
						utf8_encode($this->affiche_footer()); 
					?></footer>
					
			</html>
		<?php
	}
}
?>
